package nbcb;

import java.util.Scanner;

public class N {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n;
        while (sc.hasNext()) {
            n = sc.nextInt();
            if (n == 0) continue;
            System.out.println(count(n));
        }
    }
    public static int count(int n) {
        if (n == 1 || n == 2 || n == 3 || n == 4) return n;
        return count(n - 1) + count(n - 3);
    }
}
